<?php
if(!defined('IN_IBEIKE')) {
	exit('Access Denied');
}

class table_city_deal extends common_table
{
	public function __construct() {

		$this->_table = 'city_deal';
		$this->_pk    = 'tid';

		parent::__construct();
	}
	public function add_deal($data, $return_insert_id = false){
		if($data && is_array($data)){
			return DB::insert($this->_table, $data, $return_insert_id = false);
		}
		return 0;
	}
	public function del_deal($data){
		if($data){
			return DB::delete($this->_table, $data);
		}
		return 0;
	}
	public function fetch_by_tid($tid){
		return DB::fetch_all('SELECT * FROM %t WHERE tid=%d', array($this->_table,$tid));
	}
	public function fetch_all_by_tid($tid){
		if(!empty($tid)&&$tid){
			return DB::fetch_all('SELECT * FROM %t WHERE tid=%s',array($this->_table,$tid));//返回数组包含各个字段的值
		}
		return false;
	}
}
